//-----------------------------------------------------------------------------
// File: xmath.h
//
// Desc: math utility.
//       build20070218
//
// Author: Silva Lam
//-----------------------------------------------------------------------------
#ifndef _XMATH_H_
#define _XMATH_H_

#include "xtypes.h"

//#define MATH_PI (3.1415926535897932384626433832795)
#define MATH_PI    (3.141592654f)
#define MATH_1BYPI (0.318309886f)

#define MATHToRadian( degree ) ((degree) * (MATH_PI / 180.0f))
#define MATHToDegree( radian ) ((radian) * (180.0f / MATH_PI))


float_t xSin( float_t fangle );
float_t xCos( float_t fangle );
float_t xASin( float_t fvalue );
float_t xACos( float_t fvalue );



void xInitRandom();
int_t xGetRandom();
int_t xGetRandomMax();
float_t xGetRandomF();
float_t xGetRandomF_Range(float_t low, float_t up);


long_t xMathPositiveMod(long_t v, long_t m);
float_t xMathRealMod(float_t v, float_t m);
float_t xMathFast_sqrt( float_t n );
float_t xMath_ceil(float_t n);
float_t xMath_floor(float_t n);
float_t xMath_round(float_t n);
float_t xMath_sqrt( float_t n );
float_t xMath_rsqrt( float_t n );
float_t xMath_pow( float_t base, float_t power );
float_t xMath_fabs( float_t f );

#endif //_XMATH_H_
